import { getCVTree } from '@/request'

const MyDubber = ({ updateData, cvlist }) => {
  const handleClick = async (code) => {
    let response = await getCVTree(code)
    updateData(response, code)
  }

  return (
    <>
      <div className="dubber-container animate__animated animate__zoomIn">
        <div className="dubber-title">声优列表</div>
        <div className="box">
          {cvlist.map((item) => (
            <div
              className="list"
              key={item.id}
              onClick={() => {
                handleClick(item.code)
              }}
            >
              <div className="imgBox">
                <img src={item.cover} />
              </div>
              <div className="content">
                <h4>{item.name}</h4>
              </div>
            </div>
          ))}
        </div>
      </div>
    </>
  )
}

export default MyDubber
